﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WMPLib;

namespace harj_MyMPPlayer
{
    public partial class frmMain : Form
    {
        private WindowsMediaPlayer player;
        public frmMain()
        {
            InitializeComponent();
            InitializeMyStuff();
        }
        private void InitializeMyStuff()
        {
            //oletusarvo textboxille
            txtFilename.Text = @"D:\lol.mp3";
            player = new WindowsMediaPlayer();
            
        }

        private void frmMain_Load(object sender, EventArgs e)
        {

        }

        private void btnPlay_Click(object sender, EventArgs e)
        {
            player.URL = txtFilename.Text;
            player.controls.play();
            //UI:n viilaus
            btnPlay.Enabled = false;
            btnStop.Enabled = true;
        }

        private void btnStop_Click(object sender, EventArgs e)
        {
            player.controls.stop();
            btnPlay.Enabled = true;
            btnStop.Enabled = false;
        }
		private void btn_Browse_Click(object sender, EventArgs e) 
		{
		OpenFileDialog ofd = new OpenFileDialog();
		if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
		{
		txtFilename.Text = ofd.Filename;
		}
		}
    }
}
